package com.by.controller;

import com.by.constant.MessageConstant;
import com.by.entity.Result;
import com.by.service.ValidateCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/validateCode")
public class ValidateCodeController {

    @Autowired
    private ValidateCodeService validateCodeService;

    @RequestMapping("/send4Order")
    public Result send4Order(String telephone){
        try {
            validateCodeService.send4Order(telephone);
            return new Result(true, MessageConstant.SEND_VALIDATECODE_SUCCESS);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(true,MessageConstant.SEND_VALIDATECODE_FAIL);
        }
    }
}
